package com.idealighter.game.server.db.datadb.dao;

import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.idealighter.game.server.db.datadb.generate.domain.RoomCardNiuniuScoreDetailsDomain;
import com.idealighter.game.server.db.datadb.generate.domain.RoomCardNiuniuScoreDetailsDomainExample;
import com.idealighter.game.server.db.datadb.mapper.RoomCardNiuniuScoreDetailsMapper;
import java.util.List;

@Singleton
public class RoomCardNiuniuScoreDetailsDao {
  private RoomCardNiuniuScoreDetailsMapper mapper;

  @Inject
  public RoomCardNiuniuScoreDetailsDao(RoomCardNiuniuScoreDetailsMapper mapper) {
    this.mapper = mapper;
  }

  public RoomCardNiuniuScoreDetailsDomain selectByPrimaryKey(int id) {
    return mapper.selectByPrimaryKey(id);
  }

  /**
   * 获取roomId .
   *
   * @author abin
   * @date 2018年5月24日 下午8:33:32
   * @param roomId 房间id.
   * @return 房间得分列表.
   */
  public List<RoomCardNiuniuScoreDetailsDomain> selectByRoomId(long roomId) {
    RoomCardNiuniuScoreDetailsDomainExample example =
        new RoomCardNiuniuScoreDetailsDomainExample();
    example.createCriteria().andRoomEqualTo(roomId);
    example.setOrderByClause("player_id asc, round asc, id asc");
    return mapper.selectByExample(example);
  }

  public int insertBatch(List<RoomCardNiuniuScoreDetailsDomain> records) {
    return mapper.insertBatch(records);
  }
}
